<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>使用js传参方式上传文件</title>
    <script src="//g.tbcdn.cn/kissy/k/1.4.1/seed-min.js" charset="utf-8"></script>

</head>
<body>
<h2>使用js传参方式上传文件</h2>

<div class="grid">
    <input type="file" class="g-u" id="J_UploaderBtn" value="上传文件" name="Filedata" >
    <input type="hidden" id="J_Urls" name="urls" value="" />
</div>
<ul id="J_UploaderQueue"></ul>
<p>V1.5新增：可以使用label元素来触发文件选择</p>
<div>
    <label for="J_UploaderBtn">触发文件选择</label>
</div>
<script>
    var S = KISSY;
    if (S.Config.debug) {
        var srcPath = "../../../../";
        S.config({
            packages:[
                {
                    name:"gallery",
                    path:srcPath,
                    charset:"utf-8"
                }
            ]
        });
    }
    S.use('gallery/uploader/1.5.4/index,gallery/uploader/1.5.4/themes/default/index,gallery/uploader/1.5.4/themes/default/style.css', function (S, Uploader,DefaultTheme) {
        //上传组件插件
        var plugins = 'gallery/uploader/1.5.4/plugins/auth/auth,' +
                'gallery/uploader/1.5.4/plugins/urlsInput/urlsInput,' +
                'gallery/uploader/1.5.4/plugins/proBars/proBars';

        S.use(plugins,function(S,Auth,UrlsInput,ProBars){
            var uploader = new Uploader('#J_UploaderBtn',{
                //处理上传的服务器端脚本路径
                action:"upload.php"
            });
            //使用主题
            uploader.theme(new DefaultTheme({
                queueTarget:'#J_UploaderQueue'
            }))
                    //验证插件
            uploader.plug(new Auth({
                        //最多上传个数
                        max:3
                    }))
                     //url保存插件
                    .plug(new UrlsInput({target:'#J_Urls'}))
                    //进度条集合
                    .plug(new ProBars())
            ;
        });
    })
</script>
</body>
</html>